package MetroLab.Train;

import MetroLab.Control.ControlCenter;
import java.util.Enumeration;
import javax.media.j3d.Behavior;
import javax.media.j3d.Transform3D;
import javax.media.j3d.WakeupOnElapsedFrames;

/**
 *
 * @author plus
 */
public class RMFBehavior extends Behavior {

        private WakeupOnElapsedFrames TimeCondition;
        private Train TrainTarget;
        Transform3D transMain=new Transform3D();
        private long count = 0;

        public RMFBehavior(Train TGTrain) {
            TimeCondition=new WakeupOnElapsedFrames(1);
            TrainTarget = TGTrain;
            count=System.nanoTime();
            //initialize();
        }

        public void initialize() {
            this.wakeupOn(TimeCondition);
        }
        

        public void processStimulus(Enumeration criteria) {
            double TickCount=(System.nanoTime()-count)/1000000000d;
            ControlCenter.setFPS(1d/TickCount);
            TrainTarget.RMF(TickCount);
            count=System.nanoTime();
            this.wakeupOn(TimeCondition);
        }
    }
